abstract class Pacage{
    // 构造方法
    constructor(public w:number){}
    // 抽象方法
    // abstract calculate(x:number,y:string):number
    abstract calculate2():number
    // 具体方法
    printPacage(){
        console.log(`重量:${this.w},运费${this.calculate2()}`)
    }
}

// const p1=new Pacage(100);

class StandardPackage extends Pacage{
    constructor(
        w:number,
        public unitPrice:number
    ){super(w)};
    calculate2(): number {
        return this.w*this.unitPrice;
    }
}

const s1=new StandardPackage(10,5)
s1.printPacage()